<?php
/******************************************
WWW.ZEAI.CN 作者:supdes　QQ:797311 (supdes)
未经本人同意，请不要删除版权，否则将追究法律责任
*****************************************/
ob_start();
if (ini_get('session.auto_start') == 0)session_start();
require_once '../sub/init.php';
header("Cache-control: private");
!function_exists('zeai_alone') && exit('forbidden');
if (!is_mobile())exit('请用手机打开');
require_once ZEAI.'sub/conn.php';
require_once ZEAI.'sub/www_zeai_cn_sms.php';
require_once ZEAI.'cache/config_reg.php';
require_once ZEAI.'cache/config_vip.php';
require_once 'login_reg_fn.php';
/**是否库里有**/
if (is_weixin()){
	if(str_len($cook_openid)>20){
		$server_openid = $cook_openid;
	}else{
		$server_openid = wx_get_openid(0);
		setcookie("cook_openid",$server_openid,time()+31536000,"/",$_ZEAI['CookDomain']);
	}
	if(str_len($cook_openid)>20){
		chk_flag1Fn(" openid='".$server_openid."'");
	}
}elseif(ifint($cook_uid)){
	chk_flag1Fn("id=".$cook_uid." AND pwd='".trimm($cook_pwd)."' ");
}
require_once ZEAI.'sub/TGfun.php';
require_once ZEAI.'cache/config_up.php';
require_once ZEAI.'cache/udata.php';
if(ifint($cook_uid))require_once ZEAI.'sub/ZeaiUP.php';
$loginip=getip();
$reg_dataARR = explode(',',$_REG['reg_data']);
$mate_diyARR = explode(',',$_ZEAI['mate_diy']);
$cook_uid=intval($cook_uid);
$ifMobMaskWin = MobMaskWin();
$data_data_arr = data_data_arr();
if($ifMobMaskWin){
	$step2cls = '';
	$nextbtn_str = '下一步<font>(1/3)</font>';
}else{
	$step2cls = ' class="ed"';
	$nextbtn_str = '下一步<font>(2/3)</font>';
	//导入沙漏数据
	if(ifint($cook_uid)){
		$row_shalou= shalou_data($cook_uid);
		if($t=='pay'){
			if(!if_data_success($row_shalou)){
				header("Location: ".SELF);exit;
			}else{
				$step3cls = ' class="ed"';
				require_once ZEAI.'cache/config_wxgzh.php';
				$kf_tel=dataIO($_ZEAI['kf_tel'],'out');$kf_mob=dataIO($_ZEAI['kf_mob'],'out');$kf_wxpic=dataIO($_ZEAI['kf_wxpic'],'out');
			}
		}else{
			if(if_data_success($row_shalou)){
				header("Location: ".SELF."?t=pay");exit;
			}
		}
	}
}
switch ($submitok) {
	case 'submitCut_success':
		if(!ifint($cook_uid))json_exit(array('flag'=>0,'msg'=>'cook_uid为空，请刷新当前页面重新载入'));
		//裁切新头像处理
		if(!empty($_cut)){
			$shalou_photo_s = $row_shalou['photo_s'];
			$_s = cut_save('u',$_cut,'all');
			$row_shalou['photo_s']=$_s;
			$jsonstr = encode_json($row_shalou);
			$db->query("UPDATE ".__TBL_SHALOU__." SET jsonstr='$jsonstr',addtime=".ADDTIME." WHERE uid=".$cook_uid);
			//删老
			if(!empty($shalou_photo_s)){
				UP_modFn('u','del',$shalou_photo_s.'|'.smb($shalou_photo_s,'m').'|'.smb($shalou_photo_s,'b').'|'.smb($shalou_photo_s,'blur'));
			}
			json_exit(array('flag'=>'stop','msg'=>'裁切成功','_s'=>$_s));//,'_s'=>$_s,'idname'=>'photo_s'
		}else{
			json_exit(array('flag'=>0,'msg'=>'上传裁切更新失败'));
		}
	break;
	case 'ajax_click_yzm':
		$yzmarr = array('绿'=>'#0f0','蓝'=>'#00f','红'=>'#f00','黑'=>'#000','黄'=>'#fc0','粉'=>'#F8C2DE','灰'=>'#ccc','青'=>'#1EFFFB','紫'=>'#81007F','棕'=>'#993400');
		$_SESSION['colorKey'] = array_rand($yzmarr,1);
		$_SESSION['colorV']   = $yzmarr[$_SESSION['colorKey']];
		$yzmarr_new=shuffle_arr($yzmarr);
		foreach ($yzmarr_new as $k=>$V) {$echo.= '<li class=breath>'.$k.'</li>';}
		json_exit(array('flag'=>1,'bg'=>$_SESSION['colorV'],'li'=>$echo));
	break;
	case 'ajax_click_yzm_chk':
		if($v==$_SESSION['colorKey'] && $bg==$_SESSION['colorV']){
			json_exit(array('flag'=>1,'msg'=>'好样的，选择正确，正在发送手机验证码'));
		}else{
			json_exit(array('flag'=>0,'msg'=>'选择错误，请重新选择'));
		}
	break;
	case 'ajax_reg_verify':
		if ($_REG['reg_kind']==2)exit(JSON_ERROR);
		if(  $v!=$_SESSION['colorKey'] || $bg!=$_SESSION['colorV'] ){json_exit(array('flag'=>0,'msg'=>'选择错误，请重新选择获取！'));}
		unset($_SESSION["colorKey"]);
		unset($_SESSION["colorV"]);
		if(!ifmob($mob))json_exit(array('flag'=>0,'msg'=>'请输入正确的手机号码'));
		if (($Temp_regyzmrenum > $_SMS['sms_yzmnum']) && $_SMS['sms_yzmnum']>0  )json_exit(array('flag'=>0,'msg'=>'你重复发送次数过多，已暂停发送'));
		$_SESSION['Zeai_cn__verify'] = cdstr(4);
		//sms
		$rtn = Zeai_sendsms_authcode($mob,$_SESSION['Zeai_cn__verify']);
		//$rtn=0;
		if ($rtn == 0){
			setcookie("Temp_regyzmrenum",$Temp_regyzmrenum+1,time()+86400,"/",$_ZEAI['CookDomain']);  
			$chkflag = 1;
			$content = '验证码发送成功，请注意查收';//.$_SESSION['Zeai_cn__verify']
		}else{
			$chkflag = 0;
			$content = "发送失败,错误码：$rtn"."-".sms_error($rtn);
		}
		//sms end
		$_SESSION['Zeai_cn__mob'] = $mob;
		json_exit(array('flag'=>$chkflag,'msg'=>$content));
	break;
	case 'ajax_uname_addupdate':
		if ($_REG['reg_flag']==3)json_exit(array('flag'=>0,'msg'=>'本站已关闭【新用户注册】'));
		/**************** 注册前置验证 ******************/
		if ($_REG['reg_kind']==2){
			$uname = dataIO(trimhtml($uname),'in',20);
			$pwd   = trimhtml($pwd);
			if (str_len($pwd) > 20 || str_len($pwd) < 6)json_exit(array('flag'=>0,'msg'=>'密码长度请控制在6~20长度'));
			$pwd   = md5($pwd);
			if (ifint($uname,'0-9','1,8')){
				$dataflag = chk_flag1Fn("id='".$uname."'",2);
			}elseif(ifmob($uname)){
				$dataflag = chk_flag1Fn("mob='$uname' AND FIND_IN_SET('mob',RZ) ",2);
			}else{
				if (str_len($uname) > 20 || str_len($uname) < 3)json_exit(array('flag'=>0,'msg'=>'请输入正确的登录帐号（3~20位字母或加数字组合）'));
				if (ifmob($uname) || ifint($uname))json_exit(array('flag'=>0,'msg'=>'登录用户名不能是手机号码和纯数字'));
				if (!preg_match('/^[A-Za-z0-9_\x{4e00}-\x{9fa5}]+$/u',$uname) )json_exit(array('flag'=>0,'msg'=>'请输入正确的用户名（3~15位字母或加数字组合）'));
				$dataflag = chk_flag1Fn("uname='".$uname."'",2);
			}
		}else{
			if (!ifmob($mob))json_exit(array('flag'=>0,'msg'=>'请输入正确的手机号码'));
			if (empty($_SESSION['Zeai_cn__verify'])){
				json_exit(array('flag'=>0,'msg'=>'短信验证码错误，请重新获取'));
			}else{
				if ($_SESSION['Zeai_cn__verify'] != $verify)json_exit(array('flag'=>0,'msg'=>'您填的短信验证码不正确'));
				if ($_SESSION['Zeai_cn__mob'] != $mob){
					unset($_SESSION["Zeai_cn__mob"]);
					json_exit(array('flag'=>0,'msg'=>'手机号码异常，请重新获取'));
				}
			}
			$dataflag = chk_flag1Fn("mob='".$mob."' AND FIND_IN_SET('mob',RZ) ");
		}
		//login专用
		if($dataflag==2 && $fromurl=='login'){
			$nexturl = ($_REG['reg_style'] == 2)?'reg_diy.php':'reg_alone.php';
			$msg='您已经注册，下一步';
			if($js==1){
				json_exit(array('flag'=>1,'msg'=>$msg,'jumpurl'=>$nexturl));
			}else{
				callmsg($msg,$nexturl);
			}
		}
		/**************** 新用户入库默认值处理 ******************/
		switch ($_REG['reg_kind']){
			case 1:$uname = 'm'.cdstr(5);$pwd=md5(cdnumletters(5));break;
			case 2:$mob = 0;break;
		}
		$regkind   = 6;
		$tguid     = intval($tguid);
		$admid     = intval($admid);
		$subscribe = intval($subscribe);
		$flag      = 2;
		$ip=getip();
		$reg_if2   = 9999;
		$sjtime    = 0;
		$sjtime2   = 0;
		$reg_grade = (ifint($_REG['reg_grade']) && $_REG['reg_grade']<=20)?intval($_REG['reg_grade']):1;
		$row = $db->ROW(__TBL_ROLE__,"if2","kind=1 AND grade=".$reg_grade,"num");
		if ($row)$reg_if2= $row[0];
		if($reg_grade>1){$sjtime=ADDTIME;$sjtime2=ADDTIME+86400*$reg_if2;}
		/**************** 入库 ******************/
		$ifINSERT = true;$SQL="";
		if(is_weixin()){
			if(str_len($server_openid)>20){
				//关注过有记录
				$row2 = $db->ROW(__TBL_USER__,"id","openid='".$server_openid."'");
				if ($row2){
					$uid = $row2['id'];
					$db->query("UPDATE ".__TBL_USER__." SET pwd='$pwd',flag=$flag,grade=$reg_grade,if2=$reg_if2,sjtime=$sjtime,sjtime2=$sjtime2,endip='$endip',refresh_time=".ADDTIME."  WHERE id=".$uid);
					$ifINSERT=false;
				}else{
					$SQL = "openid='$server_openid'";
				}
			}
		}
		if($ifINSERT){
			if($_REG['reg_flag']==3)json_exit(array('flag'=>0,'msg'=>'已暂停新用户注册'));
			$db->query("INSERT INTO ".__TBL_USER__." (subscribe,flag,uname,pwd,grade,if2,sjtime,sjtime2,regtime,endtime,regip,endip,refresh_time,regkind,tguid) VALUES ($subscribe,$flag,'".$uname."','".$pwd."',$reg_grade,$reg_if2,$sjtime,$sjtime2,".ADDTIME.",".ADDTIME.",'$ip','$ip',".ADDTIME.",$regkind,$tguid)");
			$uid = intval($db->insert_id());
		}
		if(ifmob($mob) && ($_REG['reg_kind']==1 || $_REG['reg_kind']==3))$db->query("UPDATE ".__TBL_USER__." SET mob='$mob',RZ='mob' WHERE id=".$uid);
		//为空自动更新openid v8.2
		if(is_weixin() && str_len($server_openid)>20 && !empty($SQL))$db->query("UPDATE ".__TBL_USER__." SET ".$SQL." WHERE id=".$uid);
		/**************** 第三方 ******************/
		if(ifint($tmpid)){
			$row = $db->ROW(__TBL_TMP__,"c","id=".$tmpid,"num");
			if ($row){
				$c        = json_decode($row[0],true);
				$regkind  = $c['regkind'];
				/**** QQ ******/
				if($regkind=='qq'){
					$regkind  = 4;
					$loginkey = $c['openid'];
					$nickname = dataIO($c['nickname'],'in',20);
					//$dbname = (!empty($c['photo_s']))?wx_get_uinfo_logo($c['photo_s'],$uid):'';
					//$photo_s=setpath_s($dbname);
					$db->query("UPDATE ".__TBL_USER__." SET regkind=$regkind,loginkey='$loginkey',nickname='$nickname' WHERE id=".$uid);//,photo_s='$photo_s'
				/**** weixin ****/
				}elseif($regkind=='weixin'){
					$regkind=3;
					$openid   = $c['openid'];
					$nickname = dataIO($c['nickname'],'in',20);
					$unionid  = $c['unionid'];
					//$dbname = (!empty($c['headimgurl']))?wx_get_uinfo_logo($c['headimgurl'],$uid):'';
					//$photo_s=setpath_s($dbname);
					$db->query("UPDATE ".__TBL_USER__." SET regkind=$regkind,openid='$openid',unionid='$unionid',nickname='$nickname' WHERE id=".$uid);//,photo_s='$photo_s'
				}elseif($regkind=='app'){
					$regkind=8;
					$unionid  = $c['unionid'];
					$db->query("UPDATE ".__TBL_USER__." SET regkind=$regkind,unionid='$unionid' WHERE id=".$uid);//,photo_s='$photo_s'
				}
			}
			$db->query("DELETE FROM ".__TBL_TMP__." WHERE id=".$tmpid);
		}
		if(ifint($admid)){
			$row2 = $db->ROW(__TBL_ADMIN__,"truename,agentid,agenttitle","id=".$admid,"name");
			if ($row2){
				$admname = $row2['truename'];
				$agentid = intval($row2['agentid']);
				$agenttitle = $row2['agenttitle'];
				$db->query("UPDATE ".__TBL_USER__." SET admtime=".ADDTIME.",admid=$admid,admname='$admname',agentid='$agentid',agenttitle='$agenttitle' WHERE id=".$uid);
			}
		}
		shalou_init($uid);
		$row_shalou=shalou_data($uid);
		$row_shalou['photo_s'] = '';
		$jsonstr = encode_json($row_shalou);
		$db->query("UPDATE ".__TBL_SHALOU__." SET jsonstr='$jsonstr' WHERE uid=".$uid);
		set_data_ed_bfb($uid);
		setcookie("cook_uid",$uid,time()+31536000,"/",$_ZEAI['CookDomain']);
		setcookie("cook_pwd",$pwd,time()+31536000,"/",$_ZEAI['CookDomain']);
		$nexturl = ($_REG['reg_style'] == 2)?'reg_diy.php':'reg_alone.php';
		json_exit(array('flag'=>1,'msg'=>'登录/注册成功','jumpurl'=>$nexturl));//jumpurl专为login页面使用
	break;
	case 'btn_save_update':
		if($_REG['reg_flag']==3)json_exit(array('flag'=>0,'msg'=>'已暂停注册'));
		if(!ifint($cook_uid))json_exit(array('flag'=>0,'msg'=>'cook_uid为空，请刷新当前页面重新载入'));
		$FARR = $_POST;
		unset($FARR['submitok']);unset($FARR['js']);unset($FARR['uid']);unset($FARR['weixin_pic']);
		$FT=json_decode(FT,true);
		if (count($FARR) >= 1 && is_array($FARR)){
			$newARR=array();
			foreach ($FARR as $k=>$V) {
				if(strstr($k,'form_mate_')){
					$k2=str_replace('form_mate_','mate_',$k);
					$newARR[$k2]=$V;
				}else{
					$newARR[$k]=$V;
				}
			}
			$SQLli=array();
			foreach ($newARR as $F=>$V) {
				switch ($F) {
					case 'aboutus':$V = dataIO(trimhtml($V,'keep_rn'),'in',2000);break;
					case 'mate_other':$V = dataIO(trimhtml($V,'keep_rn'),'in',500);break;
					case 'nickname':$V = dataIO($V,'in',50);break;
					default:$V = dataIO($V,'in',200);break;
				}
				if(strstr($F,'mate_')){
					$ext = mate_diy_par(str_replace("mate_","",$F),'ext');
					if($ext=='radiorange'){
						$Varr=explode(',',$V);
						$mate_form1=$Varr[0];$mate_form2=$Varr[1];
						if(empty($mate_form1) && $F!='mate_other')json_exit(array('flag'=>0,'msg'=>'请完善《择偶要求》【'.$FT[$F.'1']['t'].'】信息哦'));
						if(empty($mate_form2) && $F!='mate_other')json_exit(array('flag'=>0,'msg'=>'请完善《择偶要求》【'.$FT[$F.'2']['t'].'】信息哦'));
						if(!empty($mate_form1)){
							$row_shalou[$F.'1']=$mate_form1;
							//$SQLli[]=$F.'1'."='".$mate_form1."'";
						}
						if(!empty($mate_form2)){
							$row_shalou[$F.'2']=$mate_form2;
							//$SQLli[]=$F.'2'."='".$mate_form2."'";
						}
					}else{
						if(empty($V) && $F!='mate_other')json_exit(array('flag'=>0,'msg'=>'请完善《择偶要求》【'.$FT[$F]['t'].'】信息哦'));
						$row_shalou[$F]=$V;
						//$SQLli[]=$F."='".$V."'";
					}
				}else{
					if(empty($V) || $V=='0000-00-00')json_exit(array('flag'=>0,'msg'=>'请完善【'.$FT[$F]['t'].'】信息哦'));
					$row_shalou[$F]=$V;
					//$SQLli[]=$F."='".$V."'";
				}
			}
			//资料入库
			$new_row_shalou=encode_json($row_shalou);
			$db->query("UPDATE ".__TBL_SHALOU__." SET jsonstr='$new_row_shalou',photo_f=0 WHERE uid=".$cook_uid);
			/*
			if(is_array($SQLli) && count($SQLli)>0){
				$SQLli = implode(',',$SQLli);
			}
			set_data_ed_bfb($cook_uid);
			*/
			$db->query("UPDATE ".__TBL_USER__." SET sex='".intval($row_shalou['sex'])."',dataflag=0 WHERE id=".$cook_uid);
			json_exit(array('flag'=>1,'msg'=>'资料提交成功'));
		}else{
			json_exit(array('flag'=>0,'msg'=>'数据为空提交异常'));
		}
	break;
}
$urlpar = 'subscribe='.intval($subscribe).'&tguid='.intval($tguid).'&admid='.intval($admid).'&tmpid='.intval($tmpid).'&ifback=1';
/********************************************************正文开始********************************************************/
$headertitle = '为您开启幸福之旅-';$nav = 'my';?>
<!doctype html><html><head><meta charset="utf-8">
<title><?php echo $headertitle;?><?php echo $_ZEAI['siteName'];?></title>
<?php echo HEADMETA; ?>
<link href="<?php echo RES;?>m/css/m.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<link href="<?php echo HOST;?>/cache/zeaicolor.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<script src="<?php echo RES;?>www_zeai_cn.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="<?php echo RES;?>m/js/m.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="<?php echo HOST;?>/cache/udata.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="<?php echo RES;?>zeai_ios_select/separate/select.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="<?php echo RES;?>m/js/birthday.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="<?php echo HOST;?>/cache/areadata.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="<?php echo RES;?>m/js/zeai_div_area.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script>
var upurl='<?php echo SELF;?>',Sbindbox='z-e-a-i__c-n',jumpurl = '<?php echo urlencode($jumpurl);?>',upMaxMB = <?php echo intval($_UP['upMaxMB']); ?>,browser='<?php echo browser();?>',reg_kind=<?php echo $_REG['reg_kind']?>,maxnum=1,up2='<?php echo UP;?>',cook_uid=<?php echo $cook_uid;?>;
</script>
<script src="<?php echo RES;?>m/js/ZeaiUP.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="<?php echo RES;?>m/js/reg_alone.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<link href="<?php echo RES;?>m/css/reg_alone.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<meta name="generator" content="Zeai.cn V9" />
<?php
if (is_weixin()){
    require_once ZEAI."api/weixin/jssdk.php";?>
    <script src="<?php echo RES;?>jweixin-1.2.0.js"></script>
    <script>
    wx.config({debug: false,
        appId: '<?php echo $signPackage["appId"];?>',
        timestamp: <?php echo $signPackage["timestamp"];?>,
        nonceStr: '<?php echo $signPackage["nonceStr"];?>',
        signature: '<?php echo $signPackage["signature"];?>',
        jsApiList: ['chooseImage','uploadImage','previewImage','hideMenuItems','onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ','onMenuShareWeibo']
    });
    </script>
<?php }?>
<style>
.TRnav_btn,.TRnav .TRnav_btn2 i,.regbox dl dd span.ed{color:<?php echo $_ZEAI['mob_mbcolor'];?>}
.step li.ed i{border:<?php echo $_ZEAI['mob_mbcolor'];?> .2rem solid;color:<?php echo $_ZEAI['mob_mbcolor'];?>}
.step li.ed span{color:<?php echo $_ZEAI['mob_mbcolor'];?>}
.step li.ed div,.tbody h2 b{background-color:<?php echo $_ZEAI['mob_mbcolor'];?>}
.nextbtn button,
.nextbtn a.btn,
#photo_s_btn,
.reg_private .C .agreebox button:last-child,
#MobMaskWin button{box-shadow:0 .3rem .8rem rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.4);background:-webkit-linear-gradient(315deg,rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.6) 0%,<?php echo $_ZEAI['mob_mbcolor'];?> 100%);background-color:#fff}
.icoadd{border-color:rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.2);background-color:rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.05)}
.icoadd h5,.icoadd i.ico{color:rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.6)}
.areabox .ul li a{position:relative;color:#666;background-color:#f7f7f7;height:3rem;line-height:3rem;margin:.5rem;overflow:hidden;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;border:0;padding:0 .8rem}
.areabox .ul li a:hover:before,.areabox .ul li a.ed:before{position:absolute;font-family:"www_zeai_cn_iconfont" !important;content:"\e64a";width:1.5rem;height:1.5rem;line-height:1.5rem;font-size:1.6rem;right:0;bottom:0}
.areabox .ul li a.ed{border-radius:.3rem .3rem 0 .3rem}
.areabox .ul dt.ed{border-top-color:<?php echo $_ZEAI['mob_mbcolor'];?>;color:<?php echo $_ZEAI['mob_mbcolor'];?>}
.areabox .ul li a.ed{background-color:<?php echo $_ZEAI['mob_mbcolor'];?>;background:-webkit-linear-gradient(315deg,rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.6) 0%,<?php echo $_ZEAI['mob_mbcolor'];?> 100%);background-color:#fff}
.zeaiForm .ios-select-widget-box header.iosselect-header{height:51px;line-height:44px;background:#fff}
.zeaiForm .ios-select-widget-box.olay {background-color:rgba(0,0,0,.6);z-index:890}
.zeaiForm .ios-select-widget-box.olay > div {width:100%;top:auto;bottom:0;left:0;border-radius:12px;padding-bottom:58px;background-color:#fff;}
.zeaiForm .ios-select-widget-box.olay > div h2{font-size:16px;text-align:left;float:left;padding-left:3%;}
.zeaiForm .ios-select-widget-box header.iosselect-header a.sure {margin: 8px 10px 0 0;border-radius:5px}
.zeaiForm .iosselect-header{display:block}
.zeaiForm .ios-select-widget-box .cover-area1 {top:157px}
.zeaiForm .ios-select-widget-box .cover-area2 {top:191px}
.divBtmMod .form ul.RCW li{width:50%}
.mask{background-color:rgba(0,0,0,.6)}
.select,.input,.textarea{font-size:1.4rem}
.ios-select-widget-box header.iosselect-header a.sure,
.divBtmMod .divBtmSave,
.checkskin:checked + label.checkskin-label i{border-radius:.5rem;background:-webkit-linear-gradient(315deg,rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.6) 0%,<?php echo $_ZEAI['mob_mbcolor'];?> 100%);background-color:#fff}
.checkskin:checked + label.checkskin-label i{border-radius:4.5rem;border-color:<?php echo $_ZEAI['mob_mbcolor'];?>;}
.checkskin-label i{border-radius:2rem}
</style>
</head><body>
<?php
$mini_class='top_mini4';$mini_title='';$mini_L='<em onClick="zeai.goback();" style="z-index:9999"><i class="ico" >&#xe602;</i><span></span></em>';require_once ZEAI.'m/top_mini.php';
if ($_REG['reg_flag']==3){?>
	<div class="nodataSorry">
    	<i class="ico">&#xe659;</i><font>新用户注册已关闭<br>开通日期另行通知</font>
        <a href="<?php echo HOST;?>" class="btn size4 zeaibg yuan">返回首页</a>
    </div><?php exit;
}
if(!empty($_ZEAI['data_nomodF'])){
	$data_nomodF = explode(',',$_ZEAI['data_nomodF']);
	$noT = array();
	foreach ($data_nomodF as $f) {$noT[] = data_data_title($f);}
	$data_nomodF = (is_array($noT))?'<br>注册完成后，'.implode('、',$noT).'无法更改':'';
}
?>
<div class="step" id="step">
    <li class="ed"><i>1</i><span>帐号信息</span><div></div></li>
    <li<?php echo $step2cls;?>><i>2</i><span>登记资料</span><div></div></li>
    <li<?php echo $step3cls;?>><i>3</i><span>注册完成</span><div></div></li>
</div>
<?php
/***************************/
if($t=='pay'){
	$row = $db->ROW(__TBL_USER__,"sex","id=".$cook_uid,"name");
	$cook_sex=$row['sex'];
	$regmoney = floatval($_REG['regmoney'.$cook_sex]);
	if($regmoney>0){?>
		<div class="reg_success">
			<i class="ico flag">&#xe67f;</i>
			<h4 class="title">您的资料提交成功</h4>
			<h4 class="textsuccess">请等待我们客服人员人工审核</h4>
			<em>
			<?php if (!is_weixin()){?>
				<img src="<?php echo UP.$_GZH['wx_gzh_ewm'];?>"><font>长按二维码关注公众号 接收信息通知</font>
			<?php }else{?>
				<?php if (!empty($kf_wxpic)){?><img src="<?php echo UP.$kf_wxpic;?>"><font>加客服微信快速审核</font><br><?php }?>
			<?php }?>
			</em>
			<br><br><div class="S16">您需要支付<font class="Cf00"><?php echo $regmoney;?>元</font>审核费</div>
		</div>
		<div class="nextbtn"><button type="button" class="btn size5 ed zeaibg" id="reg_nextbtn">立即支付（￥<?php echo $regmoney;?>）</button></div>
		<script src="<?php echo HOST;?>/api/zeai_PAY.js?<?php echo $_ZEAI['cache_str'];?>"></script>
		<script>
			reg_nextbtn.onclick=function(){ZeaiM.div_up({obj:czbox,h:<?php echo (is_weixin())?25.5:32.5;?>});}
			setTimeout(function(){zeai.setScrollTop(0);},200);
		</script>
		<?php
		$jump_url = HOST.'/m/reg_alone.php';
		$money = $regmoney;
		$kind  = 20;
		$cook_money=0;
		echo '<input type="hidden" id="money" value="'.$money.'">';
		require_once 'my_pay.php';exit;
	}else{
		require_once ZEAI.'m/reg_alone_success_flag.php';
		success_flag($cook_uid);?>
        <div class="reg_success">
            <i class="ico flag">&#xe67f;</i>
            <h4 class="title">您的资料提交成功</h4>
            <h4 class="textsuccess">请等待我们客服人员人工审核</h4>
            <em>
			<?php if (is_weixin()){?>
            	<img src="<?php echo UP.$_GZH['wx_gzh_ewm'];?>"><font>长按二维码关注公众号 接收信息通知</font>
            <?php }else{?>
            	<?php if (!empty($kf_wxpic)){?><img src="<?php echo UP.$kf_wxpic;?>"><font>加客服微信快速审核</font><br><?php }?>
            <?php }?>
			<?php if (!empty($kf_tel)){?>
                <a href="tel:<?php echo $kf_tel;?>"><i class="ico">&#xe7c1;</i><?php echo $kf_tel;?></a><br>
            <?php }else{?>
                <?php if (!empty($kf_mob)){?><a href="tel:<?php echo $kf_mob;?>"><i class="ico">&#xe7c1;</i><?php echo $kf_mob;?></a><?php }?>
            <?php }?>
            </em>
            <br><a href="<?php echo HOST;?>" class="S16">进入缘分大厅<i class="ico">&#xe601;</i></font></a>
        </div>
		<div class="nextbtn"><a href="my.php" class="btn size5 ed zeaibg">我的个人中心</a></div>
        <script>setTimeout(function(){zeai.setScrollTop(0);},200);</script>
    	<?php
		exit;
	}
}
/***************************/
?>
<div class="tbody">
    <h2>基本资料<b></b></h2>
    <h5>请完善以下真实信息，否则将不能通过审核<?php echo $data_nomodF;?></h5>
</div>
<form id="z-e-a-i__c-n" class="zeaiForm">
	<?php
    //头像
    if(in_array('photo_s',$reg_dataARR)){
        $photo_s_str = (!empty($row_shalou['photo_s']))?'<img src="'.UP.smb($row_shalou['photo_s'],'m').'"><h5 class="ed"><i class="ico">&#xe691;</i> 更换照片</h5>':'<i class="ico ico2">&#xe609;</i><h5>上传头像</h5>';?>
        <div class="icoadd" id="photo_s"><?php echo $photo_s_str;?></div>
        <input type="hidden" id="photo_sid" name="photo_s" value="<?php echo $row_shalou['photo_s'];?>">
        <div id="nophoto_sBox">
            <div class="linebox"><div class="line W50"></div><div class="title BAI">照片审核通过标准</div></div>
            <div class="reg_p">
                <li><img src="<?php echo RES;?>m/img/reg_p/1.jpg"><i class="ico dui">&#xe60f;</i><font>真实居中</font></li>
                <li><img src="<?php echo RES;?>m/img/reg_p/2.jpg"><i class="ico dui">&#xe60f;</i><font>上半身照</font></li>
                <li><img src="<?php echo RES;?>m/img/reg_p/3.jpg"><i class="ico cuo">&#xe62c;</i>模糊不清</li>
                <li><img src="<?php echo RES;?>m/img/reg_p/4.jpg"><i class="ico cuo">&#xe62c;</i>过于暴露</li>
                <li><img src="<?php echo RES;?>m/img/reg_p/5.jpg"><i class="ico cuo">&#xe62c;</i>P图过度</li>
                <li><img src="<?php echo RES;?>m/img/reg_p/6.jpg"><i class="ico cuo">&#xe62c;</i>背影照</li>
                <li><img src="<?php echo RES;?>m/img/reg_p/7.jpg"><i class="ico cuo">&#xe62c;</i>头像太小</li>
                <li><img src="<?php echo RES;?>m/img/reg_p/8.jpg"><i class="ico cuo">&#xe62c;</i>非人物照</li>
                <div class="clear"></div>
            </div>
            <button type="button" class="btn W80_ size4 zeaibg yuan" id="photo_s_btn" onClick="rssssegbtnFn();">立即上传</button>
        </div>
        <script>
        photo_s.onclick=function(){ZeaiM.div_up({obj:nophoto_sBox,h:42});}
        ZeaiUP.one({url:url+zeai.extname,submitokBef:'ajax_tmpB_',btnobj:photo_s_btn,end:function(e){
            if(e.flag==1){
                ZeaiM.div_left({obj:cut_box,w:zeai.bodyW()});
                var dbname = e.dbname;
                cut_tmppic.src=up2+dbname;
                www_a9a_cn_cut = new ZEAICUT(<?php echo intval($cook_uid);?>);
                www_a9a_cn_cut.wake();
                www_a9a_cn_cut.init();
            }else{
                zeai.msg(e.msg);	
            }
        }});
        </script>
        <?php require_once ZEAI.'res/m/cut.html';
    }
    //头像结束
    ?>
    <div class="regbox">
        <?php
        foreach ($reg_dataARR as $F) {
			if($F=='photo_s' || $F=='mate')continue;
            $T=data_data_title($F,$data_data_arr);
			$D=$row_shalou[$F];
			$S=data_data_subkind($F,$data_data_arr);
            $spanid='';$placeholder='';
			//控件类型
            switch ($S) {//1:文本,2:单选,3:复选,4:区间,5:特殊
                case 1:$class='ipt';$D = trimhtml(dataIO($D,'wx'),'keep_rn');$D_str = $D;break;
                case 2:$class='slect';$D_str = udata($F,$D);break;
                case 3:$class='chckbox';
					if($F == 'tag'){
						$D_str = (ifint($row_shalou['sex']))?udata($F.$row_shalou['sex'],$D):'';
					}else{
						$D_str = udata($F,$D);
					}
				break;
				case 4:$class='slect';$D_str = udata($F,$D);break;
            }
			//控件类型-特殊
            switch ($F) {
                case 'birthday':
					$class='bthdy';$D_str = $D;
				break;
				case 'areaid':
					$class='aread';$spanid=' id="areatitle"';
					$D_str=(!empty($row_shalou['areatitle']))?$row_shalou['areatitle']:'';
				break;
				case 'area2id':
					$class='aread2';$spanid=' id="area2title"';
					$D_str=(!empty($row_shalou['area2title']))?$row_shalou['area2title']:'';
				break;
                case 'aboutus':$class='txtarea';$placeholder='请输入自我介绍&#13;&#13;例如：性格方面、家庭背景、兴趣爱好、三观、如果遇到对的人，期待什么样的生活等';break;
            }
			//为空默认值
			$D_def = '';
			if(empty($D) || $D=='0,0' || $D=='0000-00-00'){
				switch ($F) {
					case 'birthday':$Y=date('Y')-23;$D_def=$Y.'-01-15';break;
					case 'edu':$D_def=getarrdef($_UDATA[$F]);break;
					case 'pay':$D_def=getarrdef($_UDATA[$F]);break;
					case 'heigh':$D_def='170';break;
					case 'weigh':$D_def='50';break;
				}
				$D_str = ($S==1)?'请输入':'请选择';
				$span_clsname  = '';
			}else{
				$span_clsname = ' class="ed"';
			}
			?>
			<dl id="<?php echo $F;?>" class="<?php echo $class;?>" data="<?php echo (empty($D) || $D=='0,0' || $D=='0000-00-00')?$D_def:$D;?>" placeholder="<?php echo $placeholder;?>">
            	<dt><?php echo $T;?></dt><dd><span<?php echo $spanid.$span_clsname;?>><?php echo $D_str;?></span></dd>
				<?php
                if($F=='areaid'){?>
                    <div id="areabox" class="areabox"><div class="ul"><li><dl><dd></dd></dl></li></div></div>
                    <input type="hidden" id="form_areaid" name="areaid" value="<?php echo $row_shalou[$F];?>">
                    <input type="hidden" id="form_areatitle" name="areatitle" value="<?php echo $row_shalou['areatitle'];?>"><?php
                }elseif($F=='area2id'){?>
                    <div id="areabox2" class="areabox"><div class="ul"><li><dl><dd></dd></dl></li></div></div>
                    <input type="hidden" id="form_area2id" name="area2id" value="<?php echo $row_shalou[$F];?>">
                    <input type="hidden" id="form_area2title" name="area2title" value="<?php echo $row_shalou['area2title'];?>"><?php
                }else{?>
                    <input type="hidden" id="form_<?php echo $F;?>" name="<?php echo $F;?>" value="<?php echo $D;?>"><?php
                }?>
            </dl>
			<?php
        }?>
    </div>
    <?php
	if (count($mate_diyARR) >= 1 && is_array($mate_diyARR) && in_array('mate',$reg_dataARR)){?>
        <br>
        <div class="tbody">
            <h2>择偶要求<b></b></h2>
            <h5>不要为幸福设置太高门槛，不要以貌、以财取人，相处后才有可能找到真爱</h5>
        </div>
        <div class="regbox" id="zoyqbox">
            <?php
            if (count($mate_diyARR) >= 1 && is_array($mate_diyARR)){
                foreach ($mate_diyARR as $F) {
                    $ext = mate_diy_par($F,'ext');
                    switch ($ext) {
                        case 'radio':
                            $class = 'slect';
                            $mate_data     = intval($row_shalou['mate_'.$F]);
                            $mate_data_str = udata($F,$mate_data);
                        break;
                        case 'radiorange':
                            $class  = 'rang';
                            $mate_data1     = intval($row_shalou['mate_'.$F.'1']);
                            $mate_data2     = intval($row_shalou['mate_'.$F.'2']);
                            $mate_data      = $mate_data1.','.$mate_data2;
                            $dwarr=json_decode($_UDATA[$F],true);
                            $dw   = $dwarr['dw'];
                            $mate_data_str  = mateset_out($mate_data1,$mate_data2,$dw);
                            $mate_data_str = str_replace("不限","",$mate_data_str);
                        break;
                        case 'checkbox':
                            $class  = 'chckbox';
                            $mate_data     = $row_shalou['mate_'.$F];
                            $mate_data_str = udata($F,$mate_data);
                        break;
                        case 'area':$class = 'aread';break;
                    }
                    switch ($F) {
                        case 'areaid':
							$class='mate_aread';$spanid=' id="mate_areatitle"';
							$mate_data     = $row_shalou['mate_'.$F];
							$mate_data_str = $row_shalou['mate_areatitle'];
                        break;
                        case 'areaid2':
							$class='mate_aread2';$spanid=' id="mate_area2title"';
							$mate_data   = $row_shalou['mate_'.$F];
							$mate_data_str = $row_shalou['mate_areatitle2'];
                        break;
                        default:$spanid='';break;
                    }
                    //默认值
					$mate_def_data = '';
					$mate_data = str_replace("0,0","",$mate_data);
                    if(empty($mate_data)){
                        switch ($F) {
                            case 'age':$mate_def_data='23,40';break;
                            case 'edu':$mate_def_data=3;break;
                            case 'pay':$mate_def_data=5;break;
                            case 'heigh':$mate_def_data='160,175';break;
                            case 'weigh':$mate_def_data='50,70';break;
                        }
                    }
					if(empty($mate_data_str)){
						$mate_data_str = '请选择';
						$span_clsname  = '';
					}else{
						$span_clsname = ' class="ed"';
					}
					?>
                    <dl id="mate_<?php echo $F;?>" class="<?php echo $class;?>" data="<?php echo (empty($mate_data))?$mate_def_data:$mate_data;?>"><dt><?php echo mate_diy_par($F);?></dt><dd><span<?php echo $spanid.$span_clsname;?>><?php echo $mate_data_str;?></span></dd>
                    	<?php if ($F == 'areaid'){?>
                        	<div id="mate_areabox" class="areabox"><div class="ul"><li><dl><dd></dd></dl></li></div></div>
                        	<input type="hidden" id="form_mate_areatitle" name="form_mate_areatitle" value="<?php echo str_replace("请选择","",$mate_data_str);?>">
						<?php }?>
                    	<?php if ($F == 'areaid2'){?>
                            <div id="mate_areabox2" class="areabox"><div class="ul"><li><dl><dd></dd></dl></li></div></div>
                            <input type="hidden" id="form_mate_areatitle2" name="form_mate_areatitle2" value="<?php echo str_replace("请选择","",$mate_data_str);?>">
						<?php }?>
                    	<input type="hidden" id="form_mate_<?php echo $F;?>" name="form_mate_<?php echo $F;?>" value="<?php echo $mate_data;?>">
                    </dl>
            <?php }}
					$mate_other = dataIO($row_shalou['mate_other'],'out');
					$span_clsname = (empty($mate_other))?'':' class="ed"';
					?>
                    <dl id="mate_other" class="txtarea" data="<?php echo $mate_other;?>" placeholder="例如：对方三观或您的特殊要求&#13;&#13;（内容请控制在500字以内）"><dt>其他要求</dt><dd><span<?php echo $span_clsname;?>><?php echo (empty($mate_other))?'请输入':$mate_other;?></span></dd></dl>
                    <input type="hidden" id="form_mate_other" name="form_mate_other" value="<?php echo $mate_other;?>">
        </div>
    <?php }?>
    <input type="hidden" name="submitok" value="btn_save_update">
</form>
<div class="blank"></div>
<div class="nextbtn"><button type="button" class="btn size5 B zeaibg" id="btn_save"><?php echo $nextbtn_str;?></button></div>
<script>reg_alone_init();</script>
<?php
require_once ZEAI.'m/TRnav.php';
if ($ifMobMaskWin){
	//隐私条款
	$row = $db->ROW(__TBL_NEWS__,"content","id=1");
	$content = '';
	if($row)$content = dataIO($row[0],'outadm');
	if(!empty($content)){?>
		<div class="reg_private" id="reg_private">
			<div class="C">
				<h1>《个人隐私与用户协议》提示</h1><em id="reg_privateC"><?php echo $content;?></em>
				<div class="agreebox"><button class="btn FL zeaiborder zeaicolor" type="button" onClick="zeai.goback();" id="disagree">不同意</button>
				<button class="btn FR zeaibg zeaiborder" type="button" id="agree">同意</button></div>
			</div>
		</div>
		<script>setTimeout(agreeDeclara,500);</script>
		<?php
	}else{?>
    <script>setTimeout(function(){zeai.mask({son:MobMaskWin,cancelBubble:'off',click:'no'});},200);</script>
    <?php }?>
    <form  id="MobMaskWin" class="WWW__ZEAI_CN_form divTopDown">
    	<?php if ($_REG['reg_kind'] == 2){?>
            <dl><dt><i class="ico">&#xe664;</i></dt><dd><input name="uname" type="text" class="input_login" id="uname" placeholder="请输入用户名" autocomplete="off" maxlength="15" onBlur="zeai.setScrollTop(0);"></dd></dl>
            <dl><dt><i class="ico">&#xe620;</i></dt><dd><input name="pwd" type="password" class="input_login" id="pwd" placeholder="请输入密码" autocomplete="off" maxlength="20" onBlur="zeai.setScrollTop(0);"></dd></dl>
        <?php }else{ ?>
            <dl><dt><i class="ico">&#xe627;</i></dt><dd><input required name="mob" type="text" id="mob" placeholder="请输入手机号码" autocomplete="off" maxlength="11" pattern="[0-9]*" onBlur="zeai.setScrollTop(0);"></dd></dl>
            <dl><dt><i class="ico">&#xe6c3;</i></dt><dd class="yzmF">
            <input name="verify" id="verify" type="text" required maxlength="4" placeholder="请输入验证码" autocomplete="off"  onBlur="zeai.setScrollTop(0);"  pattern="[0-9]*" /><a href="javascript:verifyFn(yzmbtn);" class="yzmbtn zeaicolor" id="yzmbtn">获取验证码</a>
            </dd></dl>
            <div id="zeai_yzm" class="divTopDown"><em id="zeai_yzm_em"></em><span>这是什么颜色？点击下面文字确定</span><div class="text" id="zeai_yzm_li"></div></div>
        <?php }?>
        <input type="hidden" name="tguid" id="tguid" value="<?php echo intval($tguid);?>">
        <input type="hidden" name="tmpid" id="tmpid" value="<?php echo intval($tmpid);?>">
        <input type="hidden" name="admid" id="admid" value="<?php echo intval($admid);?>">
        <input type="hidden" name="subscribe" id="subscribe" value="<?php echo intval($subscribe);?>">
        <input type="hidden" name="submitok" id="submitok" value="ajax_uname_addupdate">
        <button type="button" class="btn size4 zeaibg yuan" onClick="regbtnFn();">确定</button>
        <a href="login.php?<?php echo $urlpar;?>" class="otherlogin" style="display:none">已有帐号密码登录<i class="ico">&#xe601;</i></a>
    </form>
<?php }?>
</body>
</html>
<?php
//首次帐号弹窗
function MobMaskWin() {
	global $db,$cook_uid,$_REG;
	if(!ifint($cook_uid))return true;
	//第一次关注没手机
	if($_REG['reg_kind']==1 || $_REG['reg_kind']==3){
		$SQL .= " AND mob<>''";
	}elseif($_REG['reg_kind']==2){
		$SQL .= " AND pwd NOT REGEXP 'www@zeai@cn@'";
	}
	$row = $db->ROW(__TBL_USER__,"id","id=".$cook_uid.$SQL,'name');
	if ($row){
		return false;
	}else{
		return true;//弹
	}
}
function data_data_title($F,$data_arr='') {$data_data=(empty($data_arr))?data_data_arr():$data_arr;foreach($data_data as $v){if($v['fieldname'] == $F)return $v['title'];}}
function data_data_subkind($F,$data_arr='') {$data_data=(empty($data_arr))?data_data_arr():$data_arr;foreach($data_data as $v){if($v['fieldname'] == $F)return $v['subkind'];}}
function getarrdef($arrstr) {
	$arr=json_decode($arrstr,true);
	$cout=intval(count($arr)/2)-1;
	$rt=$arr[$cout]['i'];
	return $rt;
}
function data_data_arr() {
	global $db;
	$rt = $db->query("SELECT fieldname,title,subkind FROM ".__TBL_UDATA__." WHERE flag=1 ORDER BY px DESC,id DESC");
	while($tmprows = $db->fetch_array($rt,'name')){
		//if (strstr($tmprows['fieldname'],'crm_') || in_array($tmprows['fieldname'],$data_disable) )continue;
		$data_data[]=$tmprows;
	}
	$data_data[]=array('fieldname'=>'mate','title'=>'择偶要求','subkind'=>5);
	return $data_data;
}
function if_data_success($row_shalou){
	global $reg_dataARR,$mate_diyARR;
	$ifmate = (@is_array($mate_diyARR) && @count($mate_diyARR)>= 1)?true:false;
	foreach ($reg_dataARR as $F){
		if($F=='mate' && $ifmate){
			foreach ($mate_diyARR as $F2){
				$S = mate_diy_par(str_replace("mate_","",$F2),'ext');
				switch ($S) {
					case 'radio':
						$V2 = intval($row_shalou['mate_'.$F2]);
					break;
					case 'radiorange':
						$mate_data1 = intval($row_shalou['mate_'.$F2.'1']);
						$mate_data2 = intval($row_shalou['mate_'.$F2.'2']);
						if(ifint($mate_data1)){$V2=$mate_data1;}
						if(ifint($mate_data2)){$V2=$mate_data2;}
					break;
					case 'checkbox':
						$V2 = $row_shalou['mate_'.$F2];
					break;
				}
				switch ($F2) {
					case 'areaid':
						$V2 = $row_shalou['mate_'.$F2];
					break;
					case 'areaid2':
						$V2 = $row_shalou['mate_'.$F2];
					break;
				}
				if(empty($V2))return false;
			}
		}else{
			if(empty($row_shalou[$F]) || $row_shalou[$F]=='0000-00-00')return false;
		}
	}
	return true;
}
ob_end_flush();?>